package org.dromara.wms.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.tenant.core.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serial;
import java.util.Date;

/**
 * 生产计划排程对象 wms_schedule_line
 *
 * @author wenrui Su
 * @date 2024-05-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("wms_schedule_line")
public class WmsScheduleLine extends TenantEntity {

@Serial
private static final long serialVersionUID=1L;


  @ExcelProperty(value = "计划id")
  @NotNull(message = "计划id不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long id;

  @ExcelProperty(value = "主键")
  @TableId(value = "line_id")
  private Long lineId;

  @ExcelProperty(value = "生产线id")
  @NotNull(message = "生产线id不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long workshopId;

  @ExcelProperty(value = "物料清单")
  @NotNull(message = "物料清单不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long bomId;

  @ExcelProperty(value = "批次号")
  @NotNull(message = "批次号不能为空", groups = { AddGroup.class, EditGroup.class })
  private String batchCode;

  @ExcelProperty(value = "产品id")
  @NotNull(message = "产品id不能为空", groups = { AddGroup.class, EditGroup.class })
  private Long productId;

  @ExcelProperty(value = "开始生产")
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private Date startTime;

  @ExcelProperty(value = "结束时间")
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private Date endTime;

  @ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
  @ExcelDictFormat(dictType = "sys_status")
  @NotBlank(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
  private String status;

  @ExcelProperty(value = "需求数量")
  @NotNull(message = "数量不能为空", groups = { AddGroup.class, EditGroup.class })
  private Double quantity;

  @ExcelProperty(value = "备注")
  private String remark;

  @ExcelProperty(value = "生产计划名称")
  @TableField(exist = false)
  private String scheduleName;

  @ExcelProperty(value = "物料清单名称")
  @TableField(exist = false)
  private String bomName;

  @ExcelProperty(value = "产品名称")
  @TableField(exist = false)
  private String productName;

  @ExcelProperty(value = "生产线名称")
  @TableField(exist = false)
  private String workshopName;

  @ExcelProperty(value = "生产耗时")
  @TableField(exist = false)
  private Long costTime;

  @ExcelProperty(value = "总量")
  @TableField(exist = false)
  private Double totalQuantity;

  @ExcelProperty(value = "完成量")
  @TableField(exist = false)
  private Double totalQuantityFinished;
}
